package com.tapjoy;

import android.content.Context;
import android.content.Intent;

public class TapjoyFullScreenAd
{
  private static TapjoyFeaturedAppNotifier featuredAppNotifier;
  private static TapjoyFullScreenAdNotifier fullScreenAdNotifier;
  public static String fullScreenAdURLParams;
  private static String htmlData;
  private static TapjoyURLConnection tapjoyURLConnection = null;
  final String TAPJOY_FULL_SCREEN_AD = "Full Screen Ad";
  private Context context;
  private String currencyID;

  public TapjoyFullScreenAd(Context paramContext)
  {
    this.context = paramContext;
    tapjoyURLConnection = new TapjoyURLConnection();
  }

  public void getFeaturedApp(TapjoyFeaturedAppNotifier paramTapjoyFeaturedAppNotifier)
  {
    getFeaturedApp(null, paramTapjoyFeaturedAppNotifier);
  }

  public void getFeaturedApp(String paramString, TapjoyFeaturedAppNotifier paramTapjoyFeaturedAppNotifier)
  {
    featuredAppNotifier = paramTapjoyFeaturedAppNotifier;
    getFullScreenAdMain(paramString);
  }

  public void getFullScreenAd(TapjoyFullScreenAdNotifier paramTapjoyFullScreenAdNotifier)
  {
    getFullScreenAd(null, paramTapjoyFullScreenAdNotifier);
  }

  public void getFullScreenAd(String paramString, TapjoyFullScreenAdNotifier paramTapjoyFullScreenAdNotifier)
  {
    fullScreenAdNotifier = paramTapjoyFullScreenAdNotifier;
    getFullScreenAdMain(paramString);
  }

  public void getFullScreenAdMain(String paramString)
  {
    TapjoyLog.i("Full Screen Ad", "Getting Full Screen Ad");
    this.currencyID = paramString;
    TapjoyLog.i("Full Screen Ad", "Getting Full Screen Ad userID: " + TapjoyConnectCore.getUserID() + ", currencyID: " + this.currencyID);
    fullScreenAdURLParams = TapjoyConnectCore.getURLParams();
    fullScreenAdURLParams = fullScreenAdURLParams + "&publisher_user_id=" + TapjoyConnectCore.getUserID();
    if (this.currencyID != null)
      fullScreenAdURLParams = fullScreenAdURLParams + "&currency_id=" + this.currencyID;
    if (TapjoyConnectCore.getVideoParams().length() > 0)
      fullScreenAdURLParams = fullScreenAdURLParams + "&" + TapjoyConnectCore.getVideoParams();
    new Thread(new Runnable()
    {
      public void run()
      {
        TapjoyHttpURLResponse localTapjoyHttpURLResponse = TapjoyFullScreenAd.tapjoyURLConnection.getResponseFromURL("https://ws.tapjoyads.com/get_offers/featured.html?", TapjoyFullScreenAd.fullScreenAdURLParams);
        if (localTapjoyHttpURLResponse != null)
          switch (localTapjoyHttpURLResponse.statusCode)
          {
          default:
            if (TapjoyFullScreenAd.featuredAppNotifier != null)
              TapjoyFullScreenAd.featuredAppNotifier.getFeaturedAppResponseFailed("Error retrieving full screen ad data from the server.");
            if (TapjoyFullScreenAd.fullScreenAdNotifier != null)
              TapjoyFullScreenAd.fullScreenAdNotifier.getFullScreenAdResponseFailed(1);
            break;
          case 200:
          }
        do
        {
          do
          {
            return;
            TapjoyFullScreenAd.access$102(localTapjoyHttpURLResponse.response);
            if (TapjoyFullScreenAd.featuredAppNotifier != null)
              TapjoyFullScreenAd.featuredAppNotifier.getFeaturedAppResponse(null);
          }
          while (TapjoyFullScreenAd.fullScreenAdNotifier == null);
          TapjoyFullScreenAd.fullScreenAdNotifier.getFullScreenAdResponse();
          return;
          if (TapjoyFullScreenAd.featuredAppNotifier != null)
            TapjoyFullScreenAd.featuredAppNotifier.getFeaturedAppResponseFailed("Error retrieving full screen ad data from the server.");
        }
        while (TapjoyFullScreenAd.fullScreenAdNotifier == null);
        TapjoyFullScreenAd.fullScreenAdNotifier.getFullScreenAdResponseFailed(2);
      }
    }).start();
  }

  public void setDisplayCount(int paramInt)
  {
  }

  public void showFeaturedAppFullScreenAd()
  {
    if ((htmlData != null) && (htmlData.length() > 0))
    {
      Intent localIntent = new Intent(this.context, TapjoyFeaturedAppWebView.class);
      localIntent.setFlags(268435456);
      localIntent.putExtra("FULLSCREEN_HTML_DATA", htmlData);
      this.context.startActivity(localIntent);
    }
  }

  public void showFullScreenAd()
  {
    if ((htmlData != null) && (htmlData.length() > 0))
    {
      Intent localIntent = new Intent(this.context, TapjoyFullScreenAdWebView.class);
      localIntent.setFlags(268435456);
      localIntent.putExtra("FULLSCREEN_HTML_DATA", htmlData);
      this.context.startActivity(localIntent);
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.tapjoy.TapjoyFullScreenAd
 * JD-Core Version:    0.6.2
 */